package com.qian.search.controller;

import com.qian.fmall.commons.ResultSet;
import com.qian.fmall.pojo.ProductVo;
import com.qian.fmall.search.service.SearchInterface;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/search")
public class SearchController {
    @DubboReference
    private SearchInterface searchInterface;
    @RequestMapping("byKeyword")
    public ResultSet EsSearchByKeyWord(String  keyword)
    {
        List<ProductVo> productVo = searchInterface.getProductVo(keyword);
        return ResultSet.ok("success",productVo);
    }
}
